PARAMETER_SECTION

	//Leading parameters
	//theta[1]		log_ro, or log_msy
	//theta[2]		steepness(h), or log_fmsy
	//theta[3]		log_m
	//theta[4]		log_avgrec
	//theta[5]		prho
	//theta[6]		alpha //antes kappa

	//init_bounded_number_vector theta(1,npar,theta_lb,theta_ub,theta_phz);
	//!! for(int i=1;i<=npar;i++) theta(i)=theta_ival(i);

	//Selectivity parameters (A very complicated ragged array)
	//init_bounded_matrix_vector sel_par(1,3,1,jsel_npar,1,isel_npar,-15.,15.,sel_phz);

	 init_number_vector log_q(1,nits,2) 

	LOC_CALCS
		//initial values for logistic selectivity parameters
		//set phase to -1 for fixed selectivity.
		for(int k=1;k<=3;k++)
		{
			if( isel_type(k)==1 || isel_type(k)==2)
			{
				sel_par(k,1,1) = log(ahat(k));
				sel_par(k,1,2) = log(ghat(k));
			}
		}
	END_CALCS
	
	//Fishing mortality rate parameters
	init_bounded_vector log_ft_pars(1,nmo,-30.,3.0,1);

	LOC_CALCS
		if(!SimFlag) log_ft_pars = log(0.045);
	END_CALCS

	//Annual recruitment deviations
	//!! int init_dev_phz = 2;
	//!! if(cntrl(5)) init_dev_phz = -1; //DEPRECATED
	//init_bounded_vector init_log_rec_devs(sage+1,nage,-15.,15.,init_dev_phz); //DEPRECATED
	init_bounded_vector log_rec_devs(1,nco,-15.,15.,2);

	objective_function_value f;

	number ro;					//unfished recruits
	number bo;					//unfished spawning stock biomass
	number alpha;
	number m;					//initial natural mortality rate
	//number m_bar;				//average natural mortality rate
	number log_avgrec;			//log of average recruitment.
	number prho;					//proportion of the observation error
	number varphi				//total precision in the CPUE & Rec anomalies.
	number so;
	number beta;
	vector ssb(1,nyr);		//spawning stock biomass yearly
	vector rt(2,nyr); 		//predicted  recruits from S-R curve yearly
	vector delta(2,nyr);	//residuals for annual stock recruitment yearly


	vector log_rt(1,nco); //log recruitment
	vector q(1,nits);			//survey catchability coefficients
        matrix sel_fish(1,nmo,1,nco);      //selectivity fishery
	matrix sel_reclas(1,nmo,1,nco);       //selectivity survey reclas
	matrix sel_pelaces(1,nmo,1,nco);   //selectivity survey pelaces

	vector avg_log_sel(1,3); //conditional penalty for objective function

	matrix nlvec(1,6,1,ilvec);	//matrix for negative loglikelihoods

       //mortality rate
	vector ft(1,nmo);
	matrix F(1,nmo,1,nco);	  //Fishing mortality per cohorts
	matrix M(1,nmo,1,nco);
	matrix Z(1,nmo,1,nco);
	matrix S(1,nmo,1,nco);

	//population
	matrix N(1,nmo,1,nco);     //Number per cohorts
	matrix sb(1,nmo,1,nco);  //spawning biomass
	matrix npop(1,nmo,1,s_nages);
	matrix npopsize(1,nmo,1,s_nlen);
	vector ntot(1,nmo); //total population
	vector biom(1,nmo);
	vector sbiom(1,nmo);
	vector vulnbiom(1,nmo); //vulnerable biomass

	//ingresar predic	
	matrix s_catco(1,nmo,1,nco); //predicted catch-per-cohort
	matrix s_pred_p_co(1,nmo,1,nco); //predicted catch prop per cohort
	vector s_pred_catch(1,nmo); //predicted monthly catch
	matrix s_catage(1,nmo,1,s_nages);
	matrix s_pred_p_age(1,nmo,1,s_nages);
	matrix s_catlen(1,nmo,1,s_nlen);
	matrix s_pred_p_fishlen(1,nmo,1,s_nlen);
	vector s_pred_cpue(1,nmo)
	vector s_pred_Brec(1,nmo)
	vector s_pred_Bpel(1,nmo)
	vector s_pred_SSB(1,nmo)
	matrix s_pred_p_reclasage(1,nmo,1,s_nages)
	matrix s_pred_p_pelaceage(1,nmo,1,s_nages)
	matrix s_pred_p_reclaslen(1,nmo,1,s_nlen)
	matrix s_pred_p_pelacelen(1,nmo,1,s_nlen)

